<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<%=request.getContextPath()%>/css/Style.css"
			type="text/css" rel="stylesheet">
		<link href="<%=request.getContextPath()%>/css/admin.css"
			type="text/css" rel="stylesheet">
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/js/img.js"></script>
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/js/jquery-1.3.2.js"></script>
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/js/select.js"></script>
		<script type="text/javascript">
			//删除
function delData(ids) {
	var flag = false;
	var s = "";
	for (i = 0; i < document.getElementsByName("sel").length; i++) {
		if (document.getElementsByName("sel")[i].checked) {
			s += document.getElementsByName("sel")[i].value + ",";
			flag = true;
		}
	}
	if (flag == false) {
		alert("\u81f3\u5c11\u9009\u62e9\u4e00\u6761\u8bb0\u5f55!");
		return false;
	}
	if (confirm("\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f")) {
		window.self.location = "delJobInos.htm?ids="+s;
	}
}

//上下页
function toPage(currentPage) {
	window.self.location = "getJobInfos.htm?currentPage="+currentPage;
}

//跳到添加页
function addData(url) {
	window.self.location = url;
    //window.showModalDialog(url,"newwin","dialogHeight: 600px; dialogWidth: 800px; dialogTop: 60px; dialogLeft: 255px; edge: Raised;");

}

//跳转到详情
function toDesc(url,id) {
	 window.showModalDialog(url+"/admin/getDesc.htm?id="+id,"new","dialogHeight: 500px; dialogWidth: 700px; dialogTop: 100px; dialogLeft: 255px; edge: Raised;");
}

		
//跳转到修改页面
function toUpdate() {
	var count = 0;
	for (i = 0; i < document.getElementsByName("sel").length; i++) {
		if(document.getElementsByName("sel")[i].checked) {
			count++;
		}
	}
	if(count > 1 || count <1) {
		alert("请选择一条记录");
		return false;
	}
	var id;
	for (i = 0; i < document.getElementsByName("sel").length; i++) {
		if (document.getElementsByName("sel")[i].checked) {
			id = document.getElementsByName("sel")[i].value;
			break;
		}
	}
	var url = "<%=request.getContextPath()%>/admin/toUpdate.htm?id="+id;
	window.self.location = url;
	//window.showModalDialog(url,"new","dialogHeight: 500px; dialogWidth: 700px; dialogTop: 100px; dialogLeft: 255px; edge: Raised;");
}

//跳转到简历
function toApplies(url,id) {
	window.self.location = url+"/admin/getApplies.htm?id="+id;
}
</script>
		<title>职位信息列表</title>
	</head>
	<body>
		<table border="0" cellspacing="0" cellpadding="0" class="thead"
			width="100%">
			<tr>
				<td style="padding: 3px;">
					当前位置:招聘职位
				</td>
			</tr>
		</table>
		<form action="<%=request.getContextPath()%>/"
			method="post" id="n_form">
			<table cellspacing="0" cellpadding="0" border="0" align="center"
				width="800">
				<tbody>
					<tr>
						<table width="100%" cellspacing="0" cellpadding="0"
							bordercolor="#003366" border="1" class="Table1">
							<tbody>
								<tr height="30px">
									<td colspan="6">
										<span class="top_c"><input type="button" class="btn"
												onclick="addData('${pageContext.request.contextPath }/admin/admin.job.add.jsp');"
												value="添加"> </span>
										<span class="top_c"><input type="button" class="btn"
												onclick="toUpdate();" value="修改"> </span>
										<span class="top_c"><input type="button" class="btn"
												onclick="delData();" value="删除"> </span>
												&nbsp;&nbsp;(<font color="red">*</font>&nbsp;删除职位信息时，请确定此职位无人投递简历，否则不能删除)
										<br>
									</td>
								</tr>
								<tr style="font-weight: bold; background: #EEEEEE;">
									<td height="25" align="center">
										<input id="cal" value="1" type="checkbox"
											onclick="selAll(value);" style="border: red 2px;">
									</td>
									<td height="25" align="center">
										职位
									</td>
									<td height="25" align="center">
										工作地点
									</td>
									<td height="25" align="center">
										招聘人数
									</td>
									<td height="25" align="center">
										详情
									</td>
									<td height="25" align="center">
										应聘情况
									</td>
								</tr>
								<c:forEach items="${pageBean.objs}" var="jobInfo">
									<tr>
										<td height="25" align="center">
											<input id="sel" name="sel" value="${jobInfo.id }" type="checkbox">
										</td>
										<td height="25" align="center">
											${jobInfo.post }
										</td>
										<td height="25" align="center">
											${jobInfo.workSpace }
										</td>
										<td height="25" align="center">
											${jobInfo.staffCount }
										</td>
										<td height="25" align="center">
											<a href="javascript:toDesc('${pageContext.request.contextPath}','${jobInfo.id}')">查看详情</a>
										</td>
										<td height="25" align="center">
											<a href="javascript:toApplies('${pageContext.request.contextPath}','${jobInfo.id }')">查看应聘简历</a>
										</td>
									</tr>
								</c:forEach>

								<tr>
									<td colspan="6" height="30px" align="right">
										<span style="padding-right: 10px">[第<b>${pageBean.currentPage
												}</b>页|共<b>${pageBean.allPages }</b>页] <c:if
												test="${pageBean.currentPage <=1}">
												<span class="disable">&lt;&lt;上一页</span>
											</c:if> <c:if test="${pageBean.currentPage > 1}">
												<span class="enable"
													onclick="toPage(${pageBean.currentPage-1})">&lt;&lt;上一页</span>
											</c:if> <c:if test="${pageBean.currentPage < pageBean.allPages }">
												<span class="enable"
													onclick="toPage(${pageBean.currentPage+1})">下一页&gt;&gt;</span>
											</c:if> <c:if test="${pageBean.currentPage >= pageBean.allPages }">
												<span class="disable">下一页&gt;&gt;</span>
											</c:if> </span>
									</td>
								</tr>
							</tbody>
						</table>











					</tr>
					<tr>
						<td style="height: 10px;" colspan="4"></td>
					</tr>

					<tr>
					</tr>
				</tbody>
			</table>
			<input type="hidden" name="nodeid" value="${nodeid}">
			<input type="hidden" name="type" value="${type}">
			<input type="hidden" name="currentPage" value="" id="currentPage">
		</form>
	</body>
</html>